import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui'
import VueResource from 'vue-resource'
import animate from 'animate.css'

import '../theme/index.css'

Vue.use(VueResource);
Vue.use(ElementUI)
Vue.http.options.emulateJSON = true;


/**
 * 拦截器,所有请求加上token
 */
Vue.http.interceptors.push(function (request, next) {

  // // modify method
  // request.method = 'POST';

  // modify headers
  request.headers.set('X-CSRF-TOKEN', 'TOKEN');
  request.headers.set('Authorization', 'Bearer TOKEN');
  if(sessionStorage.jwt){
    request.headers.set('jwt', sessionStorage.jwt);
  }

  // continue to next interceptor
  next();
});

new Vue({
  el: '#app',
  render: h => h(App)
})